package uk.ac.lkl.lpp;



import java.io.File;

import java.net.URI;

import uk.ac.lkl.lpp.xml.XMLException;


/**
 * A class that is able to read and write <code>PedagogyPlan</code>s
 * from <code>File</code>s.
 * 
 * Note that in the case of both methods below, the PedagogyPlan
 * instance is an argument, not a return value. This symmetry is
 * achieved by requiring the methods to get/set the model and ui
 * fields of the PedagogyPlan as appropriate.
 * 
 * @author Darren Pearce
 * @version $Revision$
 * @version $Date$
 * 
 */
public abstract class PedagogyPlanProcessor {

    /**
     * Write the specified plan to a file.
     * 
     * @param plan
     *            the plan
     * @param file
     *            the file
     * 
     */
    public abstract void writeToFile(PedagogyPlan plan, File file);


    /**
     * Read from a file into the specified plan.
     * 
     * @param plan
     *            the plan to update
     * @param file
     *            the file
     * 
     */
    public final void readFromFile(PedagogyPlan plan, File file) throws XMLException {
        readFromURI(plan, file.toURI());
    }


    public abstract void readFromURI(PedagogyPlan plan, URI uri)
            throws XMLException;
}
